import { TagService } from './tag.service';
import { ApiOperation, ApiQuery, ApiTags } from '@nestjs/swagger';
import { Body, Controller, Post,Query,Get } from '@nestjs/common';
import { CreateTagDto } from './dto/create-tag.dto';

@ApiTags('标签')
@Controller('tag')
export class TagController {
  constructor(private readonly tagService: TagService) {}

  @ApiOperation({ summary: '创建标签' })
  @Post()
  create(@Body() body: CreateTagDto) {
    return this.tagService.create(body.name);
  }

  @ApiOperation({summary:'获取全部标签列表'})
  @Get()
  @ApiQuery({name:'name',required:false,type:String})
  async findAll(
    @Query() query,
    @Query('pageSize') pageSize: number,
    @Query('pageNum') pageNum: number,
    @Query('name') name: string,
  ){
    return await this.tagService.findAll(query);
  }
}
